import pygame
from constants import Constants

class GameData:
    """存储游戏数据的类"""

    def __init__(self):
        self.models_init = ["通义千问-MAX", "通义千问-tour", "QWQ", "通义千问-plus"]
        self.models_game = ["<model1>", "<model2>", "<model3>", "<model4>"]

        self.character_data_init = [
            {"name": "兵长", "model": self.models_init[0], "clip_capacity": 6, "bullet_position_init": 1},
            {"name": "艾伦", "model": self.models_init[1], "clip_capacity": 6, "bullet_position_init": 2},
            {"name": "三笠", "model": self.models_init[2], "clip_capacity": 6, "bullet_position_init": 3},
            {"name": "自由之翼", "model": self.models_init[3], "clip_capacity": 6, "bullet_position_init": 4}
        ]

        self.character_data_game = [
            {"name": "<NAME>", "model": self.models_game[0], "bullet_position_game": "<BULLET_POSITION_GAME>",
             "current_position": 0, "hand": []},
            {"name": "<NAME>", "model": self.models_game[1], "bullet_position_game": "<BULLET_POSITION_GAME>",
             "current_position": 0, "hand": []},
            {"name": "<NAME>", "model": self.models_game[2], "bullet_position_game": "<BULLET_POSITION_GAME>",
             "current_position": 0, "hand": []},
            {"name": "<NAME>", "model": self.models_game[3], "bullet_position_game": "<BULLET_POSITION_GAME>",
             "current_position": 0, "hand": []},
        ]

        self.avatar_positions_one = [(50, 100), (300, 100), (550, 100), (800, 100)]
        self.avatar_positions_two = [
            (50, 50),  # 左上角
            (Constants.WIDTH - 150, 50),  # 右上角
            (50, Constants.HEIGHT - 250),  # 左下角
            (Constants.WIDTH - 150, Constants.HEIGHT - 250)  # 右下角
        ]

        self.input_values = [str(data["clip_capacity"]) for data in self.character_data_init] + \
                            [str(data["bullet_position_init"]) for data in self.character_data_init]

        self.dropdown_rects = []
        for i, pos in enumerate(self.avatar_positions_one):
            self.dropdown_rects.append(pygame.Rect(pos[0], pos[1] + 140, 150, 30))